<template>
  <div>
    <h2>ShopIndex</h2>
    {{ $route.query }}
  </div>
</template>

<script>

export default {
  data() {
    return { title: 'hello' };
  },
  beforeRouteEnter(to, from, next) {
    console.log('beforeRouteEnter', '进入组件');
    next((_this) => {
      // _this组件对象
      console.log(_this.title);
    });
  },
  beforeRouteUpdate(to, from, next) {
    console.log('ShopIndex - beforeRouteUpdate', '组件内更新');
    next();
  },
  beforeRouteLeave(to, from, next) {
    console.log('shop-index-beforeRouteLeave', '离开组件');
    next();
  }
};
</script>